package ch10.shili;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Test2 {

    public static void main(String[] args) {
        //io
        //逐行读取键盘输入 输入5行 输出到文件
        Scanner input = new Scanner(System.in);
        try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("data/five.txt"))){
            for (int i = 0; i < 5; i++){
                String line = input.nextLine();
                bufferedWriter.write(line);
                bufferedWriter.newLine();
                bufferedWriter.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
